package com.jiedeng.mapper.provider;

import org.springframework.util.StringUtils;

public class PersonSqlProvider {
    public String personCountList(String corpId,String page, String pageSize) {
        int pagenum = Integer.parseInt(pageSize) * (Integer.parseInt(page) - 1);
        String sql = "SELECT p.Person_ID,p.name,p.password,p.loginid,p.phone,p.islock,p.islock whetherLock," +
                "p.starttime,p.endtime,p.addtime,p.Corp_ID,c.Post_Caption from t_person p " +
                "left join t_corp_post c on p.Post_ID = c.Post_ID where p.Corp_Id ="+corpId+
                " ORDER BY p.islock "
                ;
        if (!StringUtils.isEmpty(pageSize)) {
            sql += "  LIMIT " + pagenum + "," + pageSize;
        }
     return sql;
    }
    public String personCountNum(String corpId) {
        String sql = "SELECT count(1) from t_person where Corp_Id="+ corpId;
        return sql;
    }

    public String personEdit(String personId) {
        String sql = "SELECT p.Person_ID,p.name,p.password,p.loginid,p.phone,p.islock,p.starttime,p.endtime,p.addtime,p.Corp_ID from t_person p where p.Person_ID ="+personId ;
        return sql;
    }
}
